package cc.yaomm.service.basic.controller.common.biz;

import cc.yaomm.common.basic.captcha.CaptchaBusiness;
import cc.yaomm.common.basic.enums.CaptchaType;
import cc.yaomm.common.biz.constant.RedisConstant;
import cc.yaomm.service.basic.controller.common.vo.ImgCaptchaParamVO;
import cc.yaomm.service.basic.service.user.PermissionService;
import com.google.common.base.Joiner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by XQL on 2021/6/17.
 */
@Service
public class CommonBiz {

    @Autowired
    private CaptchaBusiness captchaBusiness;

    @Autowired
    private PermissionService permissionsService;

    /**
     * <p>@Description : 获取图片验证码 </p>
     * <p>@Author : QiLin.Xing </p>
     * <p>@Date : 2021/6/17 11:06 </p>
     */
    public String getImgCaptcha(ImgCaptchaParamVO paramVO) {
        String key = Joiner.on(RedisConstant.SEPARATOR).join(paramVO.getSystem().getValue(), paramVO.getUuid());
        return captchaBusiness.generate(CaptchaType.IMAGE, key);
    }
}
